package com.lvkerry.orderfood.repository;


import com.lvkerry.orderfood.entity.OrderEntity;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.repository.query.QueryByExampleExecutor;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @author Kerry
 */

@Repository
public interface OrderRepository extends JpaRepository<OrderEntity, Long>, QueryByExampleExecutor<OrderEntity> {


    OrderEntity findByOrderNo(String orderNo);

    List<OrderEntity> findByLunchDate(String lunchDate);

    OrderEntity findByUserIdAndAndLunchDate(Long userId, String lunchDate);

    Page<OrderEntity> findByUserId(Long userId, Pageable pageable);


    Page<OrderEntity> findByUserIdAndOrderTimeIsGreaterThanEqual(Long userId, Long timeStamp, Pageable pageable);


}
